package com.huangkailong.gitimgbed.service.impl;

import cn.hutool.core.lang.Assert;
import com.google.inject.Inject;
import com.huangkailong.gitimgbed.service.ImgBedService;
import com.huangkailong.gitimgbed.service.JgitService;
import lombok.extern.slf4j.Slf4j;

import java.io.File;

/**
 * @author huangkl
 * @since 1.0.0
 */
@Slf4j
public class ImgBedServiceImpl implements ImgBedService {
    private final JgitService jgitService;

    @Inject
    public ImgBedServiceImpl(JgitService jgitService) {
        this.jgitService = jgitService;
    }

    @Override
    public String uploadImg(File file) throws Exception {
        Assert.notNull(file, "file 不能为 null!");
        return jgitService.addFile2RemoteRepository(file);
    }
}
